server_name=pass-server
tag=latest
port=8080
active=prod

containerid=$(docker ps -a | grep $server_name | awk '{print $1}' | sed 's/%//g')
if [ $containerid ]; then
  echo "容器存在，即将删除"
	docker stop $containerid
	docker rm $containerid
else
	echo $server_name is null
fi

docker run --restart=on-failure:3 -d --name $server_name  \
--network=host \
-e SPRING_PROFILES_ACTIVE=$active \
-e SERVER_NAME=$server_name \
-v /data/:/data  \
-p $port:$port \
$server_name:latest

echo "容器启动成功"

# 注意权限 chmod 777 deploy.sh
